package com.zb.vo;

import com.zb.annotation.NumberPattern;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @Author WEN
 * @Date 2023/9/8 0008
 **/
@Data
@ApiModel("编码商品信息更换对象")
public class CodeBatchGoodsUpdateVo {
    @NotNull(message = "商品类型不能为空")
    @NumberPattern(regexp = "^(1|2)$", message = "商品类型参数不合法", required = true)
    @ApiModelProperty(value = "商品类型：1-成品，2-备件")
    private Integer type;

    @NotNull(message = "商品ID不能为空")
    @ApiModelProperty(value = "商品ID", required = true)
    private Long goodsId;

    @NotNull(message = "商品规格ID不能为空")
    @ApiModelProperty(value = "商品规格ID")
    private Long goodsSpecId;

    @NotNull(message = "质保周期/天数不能为空")
    @ApiModelProperty(value = "质保周期/天数", required = true, example = "1")
    private Integer warrantyDay;

    @Valid
    @NotNull(message = "编码信息不能为空")
    @Size(min = 1, message = "编码信息至少填写一项")
    @ApiModelProperty(value = "编码信息对象")
    private List<Code> codes;

    @Data
    @ApiModel("更换编码对象")
    public static class Code {
        @NotNull(message = "表类型不能为空")
        @ApiModelProperty(value = "表类型", required = true)
        private Integer tableType;

        @NotNull(message = "编码ID不能为空")
        @ApiModelProperty(value = "编码ID", required = true)
        private Long id;
    }
}
